Skip to content

Sending URL Preview Bundles (MSC 4095)#34150

Open
Siriusmart wants to merge 31 commits into
element-hq:developfrom
Siriusmart:url-preview-bundle
Open

Sending URL Preview Bundles (MSC 4095)#34150
Siriusmart wants to merge 31 commits into
element-hq:developfrom
Siriusmart:url-preview-bundle

Conversation

@Siriusmart

Copy link
Copy Markdown
Member

Checklist

@Siriusmart Siriusmart requested a review from a team as a code owner July 6, 2026 13:31
@Siriusmart Siriusmart requested review from MidhunSureshR and dbkr July 6, 2026 13:31
@Siriusmart Siriusmart changed the title Sending URL Preview Bundles Sending URL Preview Bundles (MSC 4452) Jul 6, 2026

@Half-Shot Half-Shot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the right track, given you a few bits to think about. Primarily:

  • For the moment we want this to work with one preview, and a future PR can adapt us to handle multiple.
  • Moving the VM outside the context of the composer preview component is fine, but we should also clean up the usages of it.

Comment thread apps/web/@types/url-preview.ts Outdated
Comment thread apps/web/@types/url-preview.ts Outdated
Comment thread apps/web/src/components/views/rooms/wysiwyg_composer/utils/message.ts Outdated
Comment thread apps/web/src/utils/messages.ts Outdated
Comment thread apps/web/src/utils/messages.ts Outdated
Comment thread apps/web/src/components/views/rooms/MessageComposer.tsx
Comment thread apps/web/src/components/views/rooms/MessageComposerUrlPreview.tsx Outdated
Comment thread apps/web/src/components/views/rooms/MessageComposerUrlPreview.tsx
Comment thread apps/web/src/viewmodels/composer/MessageComposerUrlPreviewViewModel.ts Outdated
Comment thread docs/labs.md Outdated
@Siriusmart Siriusmart requested a review from Half-Shot July 7, 2026 10:18
@Siriusmart Siriusmart changed the title Sending URL Preview Bundles (MSC 4452) Sending URL Preview Bundles (MSC 4095) Jul 7, 2026

@Half-Shot Half-Shot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting there, have some bold suggestions.

Comment thread apps/web/src/viewmodels/composer/MessageComposerUrlPreviewViewModel.ts Outdated
Comment thread apps/web/src/components/views/rooms/SendMessageComposer.tsx Outdated
Comment thread apps/web/src/components/views/rooms/MessageComposerUrlPreview.tsx Outdated
<div className="mx_MessageComposer_wrapper">
<MessageComposerUrlPreviewWrapper
content={this.state.urlPreviewComposerContent}
content={this.props.urlPreviewVm.getSnapshot().content}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to use const { content} = useViewModel(vm) inside the component, as this won't be reactive.

@Half-Shot Half-Shot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good! Once the tests are complete I think this is ready for a spin.

private autoCompletePartCount = 0;
private transformCallback: TransformCallback | null = null;

public get contentPlainText(): string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart, I'd add a docstring to explain what this does (grabs the parts from the model, only includes Plain entries, and joins them. We're intentionally skipping mentions since previews don't care about them, but other callers might be surprised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants